package com.example.demo;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/calc")
@RestController
public class CalcController {
    @RequestMapping("/sum")
    public String add(Integer num1, Integer num2){
        if(num1==null||num2==null){
            return "输入的参数无效，请重新输入";
        }
        Integer sum=num1+num2;
        return "<h1>"+"计算机计算结果:"+sum+"</h1>";
    }
    @RequestMapping("/multiply")
    public String multiply(Integer num1,Integer num2){
        if(num1==null||num2==null){
            return "输入的参数无效,请重新输入";
        }
        Integer sum=num1*num2;
        return "<h1>"+"计算机计算结果:"+sum+"</h1>";
    }

}
